package de.iritgo.skillfull.component;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;

import de.iritgo.skillfull.component.visitor.Visitor;
import de.iritgo.skillfull.entity.Entity;

public class VisualComponentImpl extends ComponentImpl implements VisualComponent
{
	protected float scale;
	
	protected boolean relative;
	
	protected boolean visible;
	
	protected int x;
	
	protected int y;
	
	protected float rotation;

	public float getScale ()
	{
		return scale;
	}

	public void setScale (float scale)
	{
		this.scale = scale;
	}

	public void setRelative (boolean relative)
	{
		this.relative = relative;
	}

	public void setVisible(boolean visible) 
	{
		this.visible = visible;
	}
	
	public int getX() 
	{
		return x;
	}

	public void setX(int x) 
	{
		this.x = x;
	}

	public int getY() 
	{
		return y;
	}

	public void setY(int y) 
	{
		this.y = y;
	}

	public float getRotation() 
	{
		return rotation;
	}

	public void setRotation(float rotation) 
	{
		this.rotation = rotation;
	}

	public void accept (Visitor visitor)
	{
		if (components == null)
			return;

		for (Component component : components)
		{
			component.accept (visitor);
		}
	}

	public void render (GameContainer container, Graphics g, Entity entity)
	{
		if (components == null)
			return;

		for (Component component : components)
		{
			component.render (container, g, entity);
		}
	}

	public void update (GameContainer container, int delta, Entity entity)
	{
		if (components == null)
			return;

		for (Component component : components)
		{
			component.update (container, delta, entity);
		}
	}

	public void printConfiguration ()
	{
		if (components == null)
			return;

		for (Component component : components)
		{
			component.printConfiguration ();
		}
	}
}
